import request from './request'
import qs from 'qs'

// 配置具体的请求接口
export const GetJingPingDataApi = () => request.get('/products/recommend')

// 热门兑换 
export const HotApi = () => request.get("/products/hot")

// 发送注册短信验证码
export const SendPhone = (params) => request.post("/sendSMS", qs.stringify(params))

// 手机号验证码登录(含注册)
export const LoginApi = (params) => request.post('/phoneRegin', qs.stringify(params))

// 获取用户信息 
export const UserInfoApi = () => request.get('/shop/userProfiles')

// 商品页数据请求
export const GoodsDataApi = (params) => request.get('/products', { params })

// 微信登录（这个接口必须用qs对数据进行格式化）
export const WeixinLoginApi = (params) => request.post(`/wechatUsers/PCLogin`, qs.stringify(params));

// 手机绑定微信 
export const bindWechatPhoneApi = (params) => request.post('/wechatUsers/binding',qs.stringify(params))

// 手机解绑微信 
export const UnbindWechatPhoneApi = () => request.put('/wechatUsers/unbindingWeChat')

// 商品详情接口
export const GoodsDetailsApi = (params) => request.get(`/products/${params}`)

// 查看购物车接口
export const CartDataApi = () => request.get(`/shop/carts`)

// 购物车删除商品
export const CartDelApi = (params) => request.delete(`/shop/carts?productIds=${params.id}`)

// 加入购物车接口
export const AddCartApi=(params)=>request.post('/shop/carts/add',qs.stringify(params))